package juc;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class ThreadPoolExample2 {
    public static void main(String[] args) {
        ExecutorService executorService = Executors.newFixedThreadPool(3);
        for (int i = 0; i < 1000000; i++) {
            int index = i;
            executorService.execute(()-> System.out.println("task:" + index));
        }
        executorService.shutdown();
    }
}
